﻿<UserControl x:Class="JSLint.VS2010.OptionsUI.OptionsUI"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:src="clr-namespace:JSLint.VS2010.OptionsUI.HelperClasses"
             mc:Ignorable="d" 
             d:DesignHeight="550" d:DesignWidth="852" Loaded="UserControl_Loaded" Background="{x:Null}">
    <UserControl.Resources>
        <src:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" FalseValue="Hidden" TrueValue="Visible" />
        <Style TargetType="GroupBox">
            <Setter Property="Margin" Value="8,8,5,5"/>
        </Style>
        <Style TargetType="CheckBox">
            <Setter Property="Margin" Value="5,10,5,5"/>
        </Style>
        <Style TargetType="RadioButton">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Margin" Value="5,5,5,5"/>
            <Setter Property="VerticalAlignment" Value="Top" />
        </Style>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>
        <Style TargetType="Label">
            <Setter Property="Margin" Value="2,2,2,2"/>
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <TabControl  Margin="12,12,0,0" Name="tabControl1" Width="640" Height="500"  SelectionChanged="tabControl1_SelectionChanged" Loaded="tabControl1_Loaded" SelectedIndex="0">
            <TabItem Header="Visual Studio Options" IsSelected="False">
                <StackPanel Orientation="Horizontal">
                    <StackPanel Orientation="Vertical">
                        <GroupBox Header="Output" Name="groupBox1" TabIndex="1">
                            <StackPanel Orientation="Vertical">
                                <RadioButton Content="Errors" IsChecked="False" Name="outputAsError" GroupName="outputType" TabIndex="2" ToolTip="Output JSLint errors as errors to the Error List" />
                                <RadioButton Content="Warnings" Name="outputAsWarning" IsChecked="True" GroupName="outputType" TabIndex="3" ToolTip="Output JSLint errors as warnings to the Error List" />
                                <RadioButton Content="Messages" GroupName="outputType" IsChecked="False" Name="outputAsMessage" TabIndex="4" ToolTip="Output JSLint errors as informational messages to the Error List" />
                                <RadioButton Content="Tasks" Name="outputAsTask" GroupName="outputType" TabIndex="5" ToolTip="Output JSLint errors as tasks to the Task List" />
                            </StackPanel>
                        </GroupBox>
                        <CheckBox Content="Find TODO's" IsChecked="False" IsEnabled="True" Name="findTODOs" TabIndex="6" ToolTip="When checked, looks for TODO's" />
                        <GroupBox Header="TODO Output" Name="groupBox2"  IsEnabled="{Binding ElementName=findTODOs, Path=IsChecked}" TabIndex="7">
                            <StackPanel Orientation="Vertical">
                                <RadioButton Content="Errors" GroupName="todoOutputType" IsChecked="False" Name="todoAsError" TabIndex="8" ToolTip="Output JSLint errors as errors to the Error List" IsEnabled="{Binding ElementName=findTODOs, Path=IsChecked}" />
                                <RadioButton Content="Warnings" GroupName="todoOutputType" IsChecked="True" Name="todoAsWarning" TabIndex="9" ToolTip="Output JSLint errors as warnings to the Error List" IsEnabled="{Binding ElementName=findTODOs, Path=IsChecked}" />
                                <RadioButton Content="Messages" GroupName="todoOutputType" IsChecked="False" Name="todoAsMessage" TabIndex="10" ToolTip="Output JSLint errors as informational messages to the Error List" IsEnabled="{Binding ElementName=findTODOs, Path=IsChecked}" />
                                <RadioButton Content="Tasks" GroupName="todoOutputType" Name="todoAsTask" TabIndex="11" ToolTip="Output JSLint errors as tasks to the Task List" IsChecked="True" IsEnabled="{Binding ElementName=findTODOs, Path=IsChecked}" />
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical">
                                <GroupBox Header="Validate files on build" Name="include" IsEnabled="{Binding ElementName=runOnBuild, Path=IsChecked}" TabIndex="14">
                                    <StackPanel Orientation="Vertical">
                                        <CheckBox Content="HTML Files"  IsChecked="True" Name="includeHTML" ToolTip="When checked HTML files will also be checked on build" TabIndex="17" IsEnabled="{Binding ElementName=runOnBuild, Path=IsChecked}" />
                                        <CheckBox Content="CSS Files"  IsChecked="True" Name="includeCSS" ToolTip="When checked CSS files will also be checked on build"  TabIndex="16" IsEnabled="{Binding ElementName=runOnBuild, Path=IsChecked}" />
                                        <CheckBox Content="JS Files" IsChecked="True" Name="includeJS" ToolTip="When checked JavaScript files will also be checked on build"  TabIndex="15" IsEnabled="{Binding ElementName=runOnBuild, Path=IsChecked}" />
                                    </StackPanel>
                                </GroupBox>
                                <CheckBox Content="Cancel build on error"  IsChecked="True" IsEnabled="{Binding ElementName=runOnBuild, Path=IsChecked}" Name="cancelBuildOnError" TabIndex="13" ToolTip="When checked, cancels the build if JSLint reported validation errors." />
                                <CheckBox Content="Run JSLint on build" Name="runOnBuild" IsChecked="True" ToolTip="When checked, performs JSLint validation when your project builds" IsEnabled="True" TabIndex="12" />
                                <CheckBox Content="Fake @charset for CSS Files" IsChecked="True" IsEnabled="True" Name="fakeAtCharset" ToolTip="CSS files without @charset will have one added so they are recognised by JS Lint" TabIndex="18" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical">
                                <CheckBox Content="Run JSLint on save" IsChecked="False" IsEnabled="True" Name="runOnSave" TabIndex="19" ToolTip="When checked, performs JSLint validation when you save a file"  />
                                <GroupBox Header="Validate files on save"  IsEnabled="{Binding ElementName=runOnSave, Path=IsChecked}" Name="groupBox4"  TabIndex="20">
                                    <StackPanel Orientation="Vertical">                                  
                                        <CheckBox Content="HTML Files"   IsChecked="True" IsEnabled="{Binding ElementName=runOnSave, Path=IsChecked}" Name="onSaveHtml" TabIndex="23" ToolTip="When checked HTML files will also be checked on save"  />
                                        <CheckBox Content="CSS Files"  IsChecked="True" IsEnabled="{Binding ElementName=runOnSave, Path=IsChecked}" Name="onSaveCss" TabIndex="22" ToolTip="When checked CSS files will also be checked on save"  />
                                        <CheckBox Content="JS Files"  IsChecked="True" IsEnabled="{Binding ElementName=runOnSave, Path=IsChecked}" Name="onSaveJs" TabIndex="21" ToolTip="When checked JavaScript files will also be checked on save"  />
                                    </StackPanel>
                                </GroupBox>
                            </StackPanel>
                        </StackPanel>
                        <GroupBox Header="Ignore sections"  Name="groupBox3"  TabIndex="24">
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Label Content="Ignore Errors Between"  Name="label4" Target="{Binding}"  />
                                    <TextBox AcceptsReturn="True"  Name="ignoreErrorStart" Text="" ToolTip="Text to start ignored errors area"  Width="122" TabIndex="25" />
                                    <Label Content="and"  Name="label5" Target="{Binding}"   />
                                    <TextBox AcceptsReturn="True"  Name="ignoreErrorEnd" Text="" ToolTip="Text to end area of ignored area"  Width="122" TabIndex="26" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Label Content="or on lines containing"  Name="label6" Target="{Binding}"  />
                                    <TextBox AcceptsReturn="True"  Name="IgnoreErrorLine" Text="" ToolTip="Text that if present will ignore all jslint errors on that line"  Width="122" TabIndex="27" SnapsToDevicePixels="False" />
                                </StackPanel>
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                </StackPanel>
            </TabItem>
            <TabItem Header="JSLint Options" Name="tabItem1" Background="{x:Null}" IsSelected="False">
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Selected linter:"  x:Name="label7"  />
                        <ComboBox ItemsSource="{Binding Linters}" SelectedItem="{Binding Selected}" Width="200" Margin="119,4,0,0"  >
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding LinterName}"/>
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                    </StackPanel>
                    <ScrollViewer VerticalScrollBarVisibility="Auto" Width="631" Height="236">
                        <ItemsControl DataContext="{Binding Selected}"  ItemsSource="{Binding Settings}"  >
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel Orientation="Horizontal" />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <CheckBox ToolTip="{Binding Tooltip}" Content="{Binding SettingName}" IsChecked="{Binding On}" Width="203" Margin="0, 3"/>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel Orientation="Vertical" >
                            <CheckBox Content="Warn on unused variables"  x:Name="warnOnUnused" TabIndex="10" DataContext="{Binding Selected}" Visibility="{Binding WarnOnUnusedVisible}" />
                            <StackPanel Orientation="Horizontal">
                                <ComboBox Width="130" DataContext="{Binding Selected}" Visibility="{Binding QuoteMarkOptionVisible}" TabIndex="30" ItemsSource="{Binding QuoteMarkOptions}" SelectedItem="{Binding SelectedQuoteMarkOption}"/>
                                <Label Content="Quote Marks"  x:Name="lblQuoteMark"  Target="{Binding}" DataContext="{Binding Selected}" Visibility="{Binding QuoteMarkOptionVisible}" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBox  x:Name="indentSize"  Width="41" Text="4" MaxLength="2" PreviewTextInput="numeric_PreviewTextInput" TabIndex="31" />
                                <Label Content="Strict white space indentation"  Target="{Binding}" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBox  MaxLength="3" x:Name="maxlen" Text="90"  Width="41" PreviewTextInput="numeric_PreviewTextInput" TabIndex="32" />
                                <Label Content="Maximum line length" Target="{Binding}"  />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <Button Content="Reset" Height="23"  x:Name="reset"  Width="65" Click="reset_Click" TabIndex="100"/>
                                <Button Content="Clear" Height="23"  x:Name="clear"  Width="65" Click="clear_Click" TabIndex="101"/>
                            </StackPanel>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <TextBox Height="65" HorizontalAlignment="Right" x:Name="predefined" Text="" TextWrapping="WrapWithOverflow"  Width="279" AcceptsReturn="True" ToolTip="Separate global variable names with comma" TabIndex="33" />
                                <Label Content="Predefined Vars" Target="{Binding}" />
                            </StackPanel>
                            <GroupBox DataContext="{Binding Selected}" Visibility="{Binding MaxComplexityVisible}">
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Text="{Binding MaxComplexity}" Width="41" ToolTip="Maximum cyclic complexity for javascript functions" />
                                        <Label Content="Max Complexity" Target="{Binding}" />
                                        <TextBox Text="{Binding MaxDepth}" Width="41" ToolTip="Maximum depth for javascript functions" />
                                        <Label Content="Max Depth" Target="{Binding}" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Text="{Binding MaxStatements}" Width="41" ToolTip="Maximum statements for javascript functions" />
                                        <Label Content="Max Statements" Target="{Binding}" />
                                        <TextBox Text="{Binding MaxParams}" Width="41" ToolTip="Maximum number of params for javascript functions" />
                                        <Label Content="Max Params" Target="{Binding}" />
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </TabItem>
        </TabControl>
    </StackPanel>
</UserControl>
